// base64 数据解码为字节数组（Uint8Array）
function base64ToByteArray(base64Data) {
  const padding = '='.repeat((4 - (base64Data.length % 4)) % 4);
  const base64 = (base64Data + padding)
    .replace(/-/g, '+')
    .replace(/_/g, '/');

  const rawData = atob(base64);
  const buffer = new Uint8Array(rawData.length);

  for (let i = 0; i < rawData.length; i++) {
    buffer[i] = rawData.charCodeAt(i);
  }
  return buffer;
}
//创建 File 对象
export function base64ToFile  (base64Data, fileName, fileType) {
  const byteArray = base64ToByteArray(base64Data);
  return new File([byteArray], fileName, { type: fileType });
}
